package it.enricod.jcontextfree.engine.model;

import it.enricod.jcontextfree.engine.model.impl.Figure;
import it.enricod.jcontextfree.engine.model.impl.FigureParameters;
import it.enricod.jcontextfree.engine.model.impl.Paint;
import it.enricod.jcontextfree.engine.model.impl.Program;
import it.enricod.jcontextfree.engine.model.impl.RuleDef;
import it.enricod.jcontextfree.engine.model.impl.Shape;

public class DataModelFactory {

	public IProgram createProgram(String startshape) {
		return new Program(startshape);
	}

	public IRuleDef createRuleDef(String ruleName, float weight) {
		return new RuleDef(ruleName, weight);
	}

	public IShape createShape(String shapeName) {
		return new Shape(shapeName);
	}

	public IPaint createPaint() {
		return new Paint();
	}

	public IFigure createNewFigure(FigureEnum type) {
		return new Figure(type);
	}
	
	public IFigure createNewFigure(String type) {
		for(int i=0; i<FigureEnum.values().length; i++) {
			if ( type.equals(FigureEnum.values()[i].getName())) {
				return new Figure(FigureEnum.values()[i]);
				
			}
		}
		return null;
	}
	
	public IFigureParameters getFigureParameters() {
		return new FigureParameters();
		
	}
}
